package com.lanxin.hr.controller;


import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.lanxin.hr.mapper.DepartmentJobVoMapper;
import com.lanxin.hr.vo.DepartmentJobVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author author
 * @since 2025-07-22
 */
@Controller
@RequestMapping("/hr/zz-department-job")
public class ZzDepartmentJobController {

    @Autowired
    private DepartmentJobVoMapper departmentJobVoMapper;

    //查询部门下属的职位
    @RequestMapping("/listDeptJobUseSelect")
    @ResponseBody
    public String listDeptJobUseSelect(@RequestParam String deptid) {
        List<DepartmentJobVo> departmentJobVos=departmentJobVoMapper.selectDepartmentJobVoByDId(deptid);
        ObjectMapper objectMapper=new ObjectMapper();
        String listjob=null;
        try {
            listjob=objectMapper.writeValueAsString(departmentJobVos);
        } catch (JsonProcessingException e) {
            throw new RuntimeException(e);
        }
        return listjob;
    }
}
